package com.dhcc.bpm.modules.system.wrapper;

import com.dhcc.bpm.modules.system.vo.ApiScopeVO;
import com.dhcc.bpm.common.cache.DictCache;
import com.dhcc.bpm.modules.system.entity.ApiScope;
import org.springblade.core.mp.support.BaseEntityWrapper;
import org.springblade.core.tool.utils.BeanUtil;

/**
 * @ClassName ApiScopeWrapper
 * @Description 包装类,返回视图层所需的字段
 * @Author sjm
 * @Date 2020/2/21 0021 15:16
 * @Version V1.0
 * @Copyright: 2020 东华软件 . All rights reserved.
 **/
public class ApiScopeWrapper extends BaseEntityWrapper<ApiScope, ApiScopeVO> {

	public static ApiScopeWrapper build() {
		return new ApiScopeWrapper();
	}

	@Override
	public ApiScopeVO entityVO(ApiScope dataScope) {
		ApiScopeVO apiScopeVO = BeanUtil.copy(dataScope, ApiScopeVO.class);
		assert apiScopeVO != null;
		String scopeTypeName = DictCache.getValue("api_scope_type", dataScope.getScopeType().toString());
		apiScopeVO.setScopeTypeName(scopeTypeName);
		return apiScopeVO;
	}

}
